package haxeframe.utils;

class SizedHash<T> extends Hash<T> {
  public var length(default, null): Int;

  public function new() { super(); length = 0; }

  public override function set(key: String, val:T) : Void {
    if (! exists(key)) length++;
    super.set(key, val);
  }

  public override function remove(key) : Bool {
    if (exists(key)) length--;
    return super.remove(key);
  }
}